package com.demos.springcloud.gateway05_custLocalFilter.filters;

import com.google.common.collect.Lists;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

import java.util.List;

/**
 * 自定义GateWay过滤器工厂
 */
@Component
public class GetGateWayFilterFactory extends AbstractGatewayFilterFactory<GetGateWayFilterParam> {

    public GetGateWayFilterFactory() {
        super(GetGateWayFilterParam.class);
    }

    @Override
    public List<String> shortcutFieldOrder() {
        return Lists.newArrayList("paraName");
    }

    @Override
    public GatewayFilter apply(GetGateWayFilterParam config) {
        return new GetGateWayFilter(config);
    }
}
